package com.itheima;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;


import java.util.Properties;

/**
 * @author 卖报的小二郎@程序员
 * @date 2021/4/27 19:05
 */
public class SimpleDemoMain {
    public static void main(String[] args) throws NacosException {
        String serverAddr="127.0.0.1:8848";
        String dataId="nacos-simple-demo.yaml";
        String group="DEFAULT_GROUP";

        Properties properties=new Properties();
        properties.put("serverAddr",serverAddr);

        //远程获取nacos上的配置文件
        ConfigService configService = NacosFactory.createConfigService(properties);
        String config = configService.getConfig(dataId, group, 5000);

        System.out.println(config);

    }
}
